<!-- <template>
  <img alt="Vue logo" src="./assets/logo.png">
  <HelloWorld msg="Welcome to Your Vue.js App"/>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'

export default {
  name: 'App',
  components: {
    HelloWorld
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style> -->

<template>
  <h2>{{ title }}</h2>
  <h2>当前计数: {{ counter }}</h2>
  <button @click="increment">+1</button>
  <button @click="decrement">-1</button>
  <!-- <div class="product">
    <h2>我是商品</h2>
    <p>我是商品描述,9.9秒杀</p>
    <div>价格 9.9元</div>
  </div> -->
  <product-item></product-item> <!--引入组件-->
</template>

<script>
import ProductItem from './ProductItem.vue' // 引入组件

export default{
  data() {
    return {
      title: "自定义Vue",
      counter: 0
    }
  },
  methods: {
    increment() {
      this.counter++
    },
    decrement() {
      this.counter--
    }
  },
  components: { // 局部组件
    ProductItem
  }
}
</script>

<style>
  h2 {
    color: red;
  }
</style>
